from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import gettext_lazy

from users.models import User


@admin.register(User)
class UserProfileAdmin(UserAdmin):
    list_display = ['name', 'username', "telephone", 'text']
    list_per_page = 10
    fieldsets = (
        (None, {'fields': ('username', 'password')}),
        (gettext_lazy('Personal info'), {'fields': ('name', 'telephone', 'birthday', 'avatar', 'text', 'sex')}),
        (gettext_lazy('Permissions'), {
            'fields': ('is_staff', 'is_superuser'),
        }),
        # (gettext_lazy('Important dates'), {'fields': ('last_login', 'date_joined')}),
    )
    add_fieldsets = (
        (None, {u'fields': ('username', 'password1', 'password2')}),
        (gettext_lazy('用户信息'), {'fields': ('name', 'phone', 'text', 'email')}),
    )
